package com.example.baseballgame;

import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class MyDbHelper extends SQLiteOpenHelper {

	public MyDbHelper(
		Context context,//DB 소유자 
		String name, 	//파일이름
		CursorFactory factory,//커스텀 커서
		int version) {	//DB 버전
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}
	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		// 테이블 생성 + 초기 데이터 생성
		db.execSQL(
			"CREATE TABLE baseballgame (" + 
			"_id integer primary key, " +
			"id text, pwd text, score integer)");
	}
	@Override
	public void onUpgrade(
		SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL("DROP TABLE baseballgame");
		onCreate(db);
	}

}